<?php
$uid = $_SESSION['tcADMINID'];
$page = $_REQUEST['page'];

$ChkItem = $_POST['ChkItem'];
$itemcat = $_POST['itemcat'];

$countitem = count($ChkItem);
for($i=0;$i<$countitem;$i++)
{
	if($item == "") $item = $ChkItem[$i];
	else $item = $item.",".$ChkItem[$i];
}
$itemsplit = split(",",$item);

if($itemcat != "")
{
	foreach($itemsplit as $is)
	{
		$s = mysql_fetch_array(mysql_query("select * from directory where Id='$is'"));
		$category = $s['Category'];
		$itemcatg = $category.",".$itemcat;
		$sql = mysql_query("update directory set Category='$itemcatg' where Id='$is'");
		//header("Location: index.php?tc=listing&page=$page");
		echo "<script>window.location='index.php?tc=listing&page=$page'</script>";
	}
}
else
{
	//header("Location: index.php?tc=listing&page=$page");
	echo "<script>window.location='index.php?tc=listing&page=$page'</script>";
}
?>